package com.jky.stmall.exercise;

public class insertSort {
    public static void main(String[] args) {
        int[] a={5,9,1,3,4,6};
        for (int i =1;i<a.length;i++){
            int j=i;
            int t=a[i];
            while (j>0&&t<a[j-1]){
                a[j]=a[j-1];
                j--;
            }
            if (j!=i){
                a[j]=t;
            }
        }
        for (int i=0;i<a.length;i++){
            System.out.println(a[i]);
        }
    }
}
